



#ifndef _PDF_COLOUR_H_
#define _PDF_COLOUR_H_

#include <wx/colour.h>
#include <wx/string.h>

#include "wx/pdfdocdef.h"

/// Colour types
enum wxPdfColourType
{
  wxPDF_COLOURTYPE_UNKNOWN,
  wxPDF_COLOURTYPE_GRAY,
  wxPDF_COLOURTYPE_RGB,
  wxPDF_COLOURTYPE_CMYK,
  wxPDF_COLOURTYPE_SPOT,
  wxPDF_COLOURTYPE_PATTERN
};

/// Forward declaration of classes
class WXDLLIMPEXP_FWD_CORE wxColourDatabase;
class WXDLLIMPEXP_FWD_PDFDOC wxPdfPattern;
class WXDLLIMPEXP_FWD_PDFDOC wxPdfSpotColour;

/// Class representing wxPdfDocument colours.
class WXDLLIMPEXP_PDFDOC wxPdfColour
{
public:
  /// Default constructor
  
  wxPdfColour();

  /// Constructor for grayscale colour
  
  wxPdfColour(const unsigned char grayscale);
  
  /// Constructor for wxColour colour
  
  wxPdfColour(const wxColour& colour);

  /// Constructor for RGB colour
  
  wxPdfColour(const unsigned char red, const unsigned char green, const unsigned char blue);
  
  /// Constructor for CMYK colour
  
  wxPdfColour(double cyan, double magenta, double yellow, double black);
  
  /// Constructor for named RGB colour
  
  wxPdfColour(const wxString& name);
  
  /// Constructor for named RGB colour
  
  wxPdfColour(const wxPdfSpotColour& spotColour, double tint);

  /// Constructor for pattern based colour
  
  wxPdfColour(const wxPdfPattern& pattern);

  /// Copy constructor
  wxPdfColour(const wxPdfColour& colour);

  /// Assignment operator
  wxPdfColour& operator=(const wxPdfColour& colour);

  /// Set grayscale colour
  
  void SetColour(const unsigned char grayscale = 0);
  
  /// Set wxColour colour
  
  void SetColour(const wxColour& colour);
  
  /// Set RGB colour
  
  void SetColour(const unsigned char red, const unsigned char green, const unsigned char blue);
  
  /// Set CMYK colour
  
  void SetColour(double cyan, double magenta, double yellow, double black);

  /// Set a named RGB colour
  
  void SetColour(const wxString& name);

  /// Set a spot colour (internal use only)
  
  void SetColour(const wxPdfSpotColour& spotColour, double tint);

  /// Set a pattern based colour (internal use only)
  
  void SetColour(const wxPdfPattern& pattern);

  /// Get internal colour string representation (for internal use only)
  
  const wxString GetColour(bool drawing) const;

  /// Get colour type
  
  wxPdfColourType GetColourType() const { return m_type; }

  /// Get internal colour value string representation (for internal use only)
  
  const wxString GetColourValue() const;

  /// Compare colour
  
  bool Equals(const wxPdfColour& colour) const;

protected:
  /// Constructor for internal colour string representation
  wxPdfColour(const wxString& colour, bool intern);

    static wxColourDatabase* GetColourDatabase();

private:
  wxPdfColourType m_type;   ///< colour type
  wxString        m_prefix; ///< internal colour string prefix
  wxString        m_colour; 
  static wxColourDatabase* ms_colourDatabase;
};

/// Comparison operator for equality of colour objects
bool operator==(const wxPdfColour& a, const wxPdfColour& b);

/// Comparison operator for inequality of colour objects
bool operator!=(const wxPdfColour& a, const wxPdfColour& b);

#endif
